﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crystal.Common.Model;
using Crystal.CLL;

namespace CrystalCommon.BLL
{
    public class EntityTypeManager : IDisposable
    {
        #region Fields
        #endregion

        #region Methods
        public void Dispose() { }

        public void AddEntityDataSourceType(CrystalEntities context, EDS_DataSources dataSource)
        {
            context.AddToEDS_DataSources(dataSource);
            context.SaveChanges();
        }

        public void AddEntityTemplateType(CrystalEntities context, EDS_Templates templates)
        {
            context.AddToEDS_Templates(templates);
            context.SaveChanges();
        }
        public string GetTableName(CrystalEntities context, int id)
        {
            var test = from v in context.LKP_Master  
                          where v.MasterID == id
                          select v.Master;
            string Name = test.First().ToString();
            return Name;
        }
        public void AddHeadInvestor(CrystalEntities context,LKP_HeadInvestor headInvestor)
        {
            context.AddToLKP_HeadInvestor(headInvestor);
            context.SaveChanges();
        }

        public void AddInvestorType(CrystalEntities context,LKP_InvestorType investorType)
        {
            context.AddToLKP_InvestorType(investorType);
            context.SaveChanges();
        }
        public void AddMasterInvestorTypeLink(CrystalEntities context, LKP_TypeMTypeLinking  investorTypeLink)
        {
            context.AddToLKP_TypeMTypeLinking(investorTypeLink);
            context.SaveChanges();
        }
        public void AddUltimateParent(CrystalEntities context, LKP_UltimateParent ultimateParent)
        {
            context.AddToLKP_UltimateParent(ultimateParent);
            context.SaveChanges();
        }
        public void AddActivist(CrystalEntities context, LKP_Activist activist)
        {
            context.AddToLKP_Activist(activist);
            context.SaveChanges();
        }
        public void AddCountry(CrystalEntities context, LKP_Country activist)
        {
            context.AddToLKP_Country(activist);
            context.SaveChanges();
        }
        public void AddParent(CrystalEntities context, LKP_Parent parent)
        {
            context.AddToLKP_Parent(parent);
            context.SaveChanges();
        }
        public void AddStyle(CrystalEntities context,LKP_Style style)
        {
            context.AddToLKP_Style(style);
            context.SaveChanges();
        }
        public void AddCity(CrystalEntities context, LKP_City city)
        {
            context.AddToLKP_City(city);
            context.SaveChanges();
        }
        public void AddParent(CrystalEntities context, LKP_Country country)
        {
            context.AddToLKP_Country(country);
            context.SaveChanges();
        }
        public void AddTemplate(CrystalEntities context, EDS_Templates templates)
        {
            context.AddToEDS_Templates(templates);
            context.SaveChanges();
        }
        public void AddFundType(CrystalEntities context, LKP_FundType activist)
        {
            context.AddToLKP_FundType(activist);
            context.SaveChanges();
        }
        public void AddSourceName(CrystalEntities context, EDS_DataSources sourcename)
        {
            context.AddToEDS_DataSources(sourcename);
            context.SaveChanges();
        }
        public void AddListing(CrystalEntities context, LKP_Listing listing)
        {
            context.AddToLKP_Listing(listing);
            context.SaveChanges();
        }

        public void AddExchange(CrystalEntities context,LKP_Exchange exchange)
        {
            context.AddToLKP_Exchange(exchange);
            context.SaveChanges();
        }

        public void AddIndustry(CrystalEntities context, LKP_Industry  industry)
        {
            context.AddToLKP_Industry(industry);
            context.SaveChanges();
        }

        public void AddMetro(CrystalEntities context, LKP_Metro metro)
        {
            context.AddToLKP_Metro(metro);
            context.SaveChanges();
        }

        public void AddRegion(CrystalEntities context, LKP_Region  region)
        {
            context.AddToLKP_Region(region );
            context.SaveChanges();
        }

        public void AddSector(CrystalEntities context, LKP_Sector sector)
        {
            context.AddToLKP_Sector(sector);
            context.SaveChanges();
        }

        public void AddState(CrystalEntities context, LKP_State state)
        {
            context.AddToLKP_State(state);
            context.SaveChanges();
        }

        public void AddTerritory(CrystalEntities context, LKP_Territory territory)
        {
            context.AddToLKP_Territory(territory);
            context.SaveChanges();
        }
        #endregion
    }
}
